<?
//if(!MEMBER) header('location: /');
$ID = PARAMS?(is_numeric(PARAMS)?PARAMS:account::getid(PARAMS)):UID;
$data->settings = account::settings($ID);
if((!$data->settings->profile || $data->settings->profile->vcard || $data->settings->profile->profile) || EDITOR){
    $data->profile = profile::get(array('ID'=>$ID));
    define('OWN',$data->profile->ID == UID);
    // profile functions
    if(!OWN) foreach ($data->APPS as $i)
        @include 'apps/'.$i.'/trunk/_profile_func.php';
    // profile belly
    foreach ($data->APPS as $i) {
        @include 'apps/'.$i.'/trunk/_profile_content.php';
        @include 'apps/'.$i.'/trunk/_profile_aside.php';
        $widgets[] = $i;
    }

    $data->TITLE = $data->profile->fullname;
    if($data->settings->profile && !$data->settings->profile->vcard && !$data->settings->profile->profile)
            $data->TITLE .= ' ('._('Private Profile').')';
    $data->DESCRIPTION = $data->profile->fullname;

    $data->JS = $data->WIDGETS = implode(',', array_unique($widgets));

} else {
    $data->TITLE = _('Private Profile');
    $data->DESCRIPTION = _('You have not access the profile.');
}
?>